/*
74HC595驱动

*/
#define SCK 9
#define DAT 10  
int i=0;
void setup() {
  pinMode(SCK,OUTPUT);
  pinMode(DAT,OUTPUT);
  digitalWrite(SCK,HIGH);
  digitalWrite(DAT,HIGH);
  // put your setup code here, to run once:

}

void InputData(int dat)
{
  for(int i=0;i<8;i++)
  {
  if(dat&0x01==1)
  {
    digitalWrite(SCK,LOW);
    digitalWrite(DAT,HIGH);
    delayMicroseconds(10);
    }
    else
    {
      digitalWrite(SCK,LOW);
      digitalWrite(DAT,LOW);
      delayMicroseconds(10);
      }
      dat=dat>>1;
      digitalWrite(SCK,HIGH);
  }
  }
void loop() {

  InputData(i);
  delay(500);
  i++;
  if(i=0xff)
  {
  i=0;
  }
  // put your main code here, to run repeatedly:

}
